
<%@ page import="com.service.BlogService" %>
<%@ page import="com.service.BlogServiceImpl" %><%--
  Created by IntelliJ IDEA.
  User: Elle
  Date: 2022/6/16
  Time: 10:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    //处理删除请求

    //1、获取请求的数据==》<a href="doDelete.jsp?id=39">删除</a>
    String id = request.getParameter("id");

    Integer idTmp = Integer.valueOf(id);
    //2、处理==》操作数据库
    BlogService blogService = new BlogServiceImpl();
    int ret = blogService.deleteById(idTmp);
    if(ret>0){
        out.println("<script>alert('删除成功');location.href='doList.jsp'</script>");
    }else{
        out.println("<script>alert('删除失败');history.go(-1);</script>");
    }

    //3、页面跳转
%>
